(0) Obligation:
Runtime Complexity TRS:
The TRS R consists of the following rules:
check(0) → zero
check(s(0)) → odd
check(s(s(0))) → even
check(s(s(s(x)))) → check(s(x))
half(0) → 0
half(s(0)) → 0
half(s(s(x))) → s(half(x))
plus(0, y) → y
plus(s(x), y) → s(plus(x, y))
times(x, y) → timesIter(x, y, 0)
timesIter(x, y, z) → if(check(x), x, y, z, plus(z, y))
p(s(x)) → x
p(0) → 0
if(zero, x, y, z, u) → z
if(odd, x, y, z, u) → timesIter(p(x), y, u)
if(even, x, y, z, u) → plus(timesIter(half(x), y, half(z)), timesIter(half(x), y, half(s(z))))
Rewrite Strategy: FULL
(1) DecreasingLoopProof (EQUIVALENT transformation)
The following loop(s) give(s) rise to the lower bound Ω(n1):
The rewrite sequence
check(s(s(s(x)))) →+ check(s(x))
gives rise to a decreasing loop by considering the right hand sides subterm at position [].
The pumping substitution is [x / s(s(x))].
The result substitution is [ ].
(2) BOUNDS(n^1, INF)
(3) RenamingProof (EQUIVALENT transformation)
Renamed function symbols to avoid clashes with predefined symbol.
(4) Obligation:
Runtime Complexity Relative TRS:
The TRS R consists of the following rules:
check(0') → zero
check(s(0')) → odd
check(s(s(0'))) → even
check(s(s(s(x)))) → check(s(x))
half(0') → 0'
half(s(0')) → 0'
half(s(s(x))) → s(half(x))
plus(0', y) → y
plus(s(x), y) → s(plus(x, y))
times(x, y) → timesIter(x, y, 0')
timesIter(x, y, z) → if(check(x), x, y, z, plus(z, y))
p(s(x)) → x
p(0') → 0'
if(zero, x, y, z, u) → z
if(odd, x, y, z, u) → timesIter(p(x), y, u)
if(even, x, y, z, u) → plus(timesIter(half(x), y, half(z)), timesIter(half(x), y, half(s(z))))
S is empty.
Rewrite Strategy: FULL
(5) TypeInferenceProof (BOTH BOUNDS(ID, ID) transformation)
Infered types.
(6) Obligation:
TRS:
Rules:
check(0') → zero
check(s(0')) → odd
check(s(s(0'))) → even
check(s(s(s(x)))) → check(s(x))
half(0') → 0'
half(s(0')) → 0'
half(s(s(x))) → s(half(x))
plus(0', y) → y
plus(s(x), y) → s(plus(x, y))
times(x, y) → timesIter(x, y, 0')
timesIter(x, y, z) → if(check(x), x, y, z, plus(z, y))
p(s(x)) → x
p(0') → 0'
if(zero, x, y, z, u) → z
if(odd, x, y, z, u) → timesIter(p(x), y, u)
if(even, x, y, z, u) → plus(timesIter(half(x), y, half(z)), timesIter(half(x), y, half(s(z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
(7) OrderProof (LOWER BOUND(ID) transformation)
Heuristically decided to analyse the following defined symbols:
check,
half,
plus,
timesIterThey will be analysed ascendingly in the following order:
check < timesIter
half < timesIter
plus < timesIter
(8) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
The following defined symbols remain to be analysed:
check, half, plus, timesIter
They will be analysed ascendingly in the following order:
check < timesIter
half < timesIter
plus < timesIter
(9) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
check(
gen_0':s3_0(
+(
1,
*(
2,
n5_0)))) →
odd, rt ∈ Ω(1 + n5
0)
Induction Base:
check(gen_0':s3_0(+(1, *(2, 0)))) →RΩ(1)
odd
Induction Step:
check(gen_0':s3_0(+(1, *(2, +(n5_0, 1))))) →RΩ(1)
check(s(gen_0':s3_0(*(2, n5_0)))) →IH
odd
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(10) Complex Obligation (BEST)
(11) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Lemmas:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
The following defined symbols remain to be analysed:
half, plus, timesIter
They will be analysed ascendingly in the following order:
half < timesIter
plus < timesIter
(12) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
half(
gen_0':s3_0(
*(
2,
n249_0))) →
gen_0':s3_0(
n249_0), rt ∈ Ω(1 + n249
0)
Induction Base:
half(gen_0':s3_0(*(2, 0))) →RΩ(1)
0'
Induction Step:
half(gen_0':s3_0(*(2, +(n249_0, 1)))) →RΩ(1)
s(half(gen_0':s3_0(*(2, n249_0)))) →IH
s(gen_0':s3_0(c250_0))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(13) Complex Obligation (BEST)
(14) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Lemmas:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
half(gen_0':s3_0(*(2, n249_0))) → gen_0':s3_0(n249_0), rt ∈ Ω(1 + n2490)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
The following defined symbols remain to be analysed:
plus, timesIter
They will be analysed ascendingly in the following order:
plus < timesIter
(15) RewriteLemmaProof (LOWER BOUND(ID) transformation)
Proved the following rewrite lemma:
plus(
gen_0':s3_0(
n571_0),
gen_0':s3_0(
b)) →
gen_0':s3_0(
+(
n571_0,
b)), rt ∈ Ω(1 + n571
0)
Induction Base:
plus(gen_0':s3_0(0), gen_0':s3_0(b)) →RΩ(1)
gen_0':s3_0(b)
Induction Step:
plus(gen_0':s3_0(+(n571_0, 1)), gen_0':s3_0(b)) →RΩ(1)
s(plus(gen_0':s3_0(n571_0), gen_0':s3_0(b))) →IH
s(gen_0':s3_0(+(b, c572_0)))
We have rt ∈ Ω(n1) and sz ∈ O(n). Thus, we have ircR ∈ Ω(n).
(16) Complex Obligation (BEST)
(17) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Lemmas:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
half(gen_0':s3_0(*(2, n249_0))) → gen_0':s3_0(n249_0), rt ∈ Ω(1 + n2490)
plus(gen_0':s3_0(n571_0), gen_0':s3_0(b)) → gen_0':s3_0(+(n571_0, b)), rt ∈ Ω(1 + n5710)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
The following defined symbols remain to be analysed:
timesIter
(18) NoRewriteLemmaProof (LOWER BOUND(ID) transformation)
Could not prove a rewrite lemma for the defined symbol timesIter.
(19) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Lemmas:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
half(gen_0':s3_0(*(2, n249_0))) → gen_0':s3_0(n249_0), rt ∈ Ω(1 + n2490)
plus(gen_0':s3_0(n571_0), gen_0':s3_0(b)) → gen_0':s3_0(+(n571_0, b)), rt ∈ Ω(1 + n5710)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
No more defined symbols left to analyse.
(20) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
(21) BOUNDS(n^1, INF)
(22) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Lemmas:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
half(gen_0':s3_0(*(2, n249_0))) → gen_0':s3_0(n249_0), rt ∈ Ω(1 + n2490)
plus(gen_0':s3_0(n571_0), gen_0':s3_0(b)) → gen_0':s3_0(+(n571_0, b)), rt ∈ Ω(1 + n5710)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
No more defined symbols left to analyse.
(23) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
(24) BOUNDS(n^1, INF)
(25) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Lemmas:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
half(gen_0':s3_0(*(2, n249_0))) → gen_0':s3_0(n249_0), rt ∈ Ω(1 + n2490)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
No more defined symbols left to analyse.
(26) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
(27) BOUNDS(n^1, INF)
(28) Obligation:
TRS:
Rules:
check(
0') →
zerocheck(
s(
0')) →
oddcheck(
s(
s(
0'))) →
evencheck(
s(
s(
s(
x)))) →
check(
s(
x))
half(
0') →
0'half(
s(
0')) →
0'half(
s(
s(
x))) →
s(
half(
x))
plus(
0',
y) →
yplus(
s(
x),
y) →
s(
plus(
x,
y))
times(
x,
y) →
timesIter(
x,
y,
0')
timesIter(
x,
y,
z) →
if(
check(
x),
x,
y,
z,
plus(
z,
y))
p(
s(
x)) →
xp(
0') →
0'if(
zero,
x,
y,
z,
u) →
zif(
odd,
x,
y,
z,
u) →
timesIter(
p(
x),
y,
u)
if(
even,
x,
y,
z,
u) →
plus(
timesIter(
half(
x),
y,
half(
z)),
timesIter(
half(
x),
y,
half(
s(
z))))
Types:
check :: 0':s → zero:odd:even
0' :: 0':s
zero :: zero:odd:even
s :: 0':s → 0':s
odd :: zero:odd:even
even :: zero:odd:even
half :: 0':s → 0':s
plus :: 0':s → 0':s → 0':s
times :: 0':s → 0':s → 0':s
timesIter :: 0':s → 0':s → 0':s → 0':s
if :: zero:odd:even → 0':s → 0':s → 0':s → 0':s → 0':s
p :: 0':s → 0':s
hole_zero:odd:even1_0 :: zero:odd:even
hole_0':s2_0 :: 0':s
gen_0':s3_0 :: Nat → 0':s
Lemmas:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
Generator Equations:
gen_0':s3_0(0) ⇔ 0'
gen_0':s3_0(+(x, 1)) ⇔ s(gen_0':s3_0(x))
No more defined symbols left to analyse.
(29) LowerBoundsProof (EQUIVALENT transformation)
The lowerbound Ω(n1) was proven with the following lemma:
check(gen_0':s3_0(+(1, *(2, n5_0)))) → odd, rt ∈ Ω(1 + n50)
(30) BOUNDS(n^1, INF)